/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package pl.pg.misra.rules;

import java.util.ArrayList;
import java.util.List;
import pl.pg.misra.AST.AST;
import pl.pg.misra.Interfaces.IRule;

/**
 *
 * @author Paweł
 */
public class NoContinueStatementRule extends AbstractRule implements IRule {

    @Override
    public List<String> checkRule(List<AST> asts) {
        List<String> result = new ArrayList<>();
        List<AST> searchResult;
        
        for (AST function : asts){
            searchResult = new ArrayList<>();

            searchResult = findNodesByType("ContinueStmt", function, searchResult);

            if (!searchResult.isEmpty()){
                result.add(buildViolationMessage(function, "14.5", "continue statement used"));
            }
        }
        
        return result;
    }
    
}
